home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 November: Tool Chest / Dev.CD Nov 94.toast / New System Software Extensions / OpenDoc A6 / OpenDoc Parts Framework / OPF / Found / FWString / Include / FWStrs.tpp < prev    next >
Encoding:
Text File  |  1994-04-21  |  3.9 KB  |  130 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWStrs.tpp
  4. //    Release Version:    $ 1.0d1 $
  5. //
  6. //    Creation Date:        3/28/94
  7. //
  8. //    Copyright:    © 1994 by Apple Computer, Inc., all rights reserved.
  9. //
  10. //========================================================================================
  11.  
  12. #ifdef FW_BUILD_MAC
  13. #include <Types.h>
  14. #endif
  15.  
  16. #ifndef   FWEXCLIB_H
  17. #include "FWExcLib.h"
  18. #endif
  19.  
  20. #ifndef FWMATH_H
  21. #include "FWMath.h"
  22. #endif
  23.  
  24. #ifndef FWSTRS_H
  25. #include "FWStrs.h"
  26. #endif
  27.  
  28. #ifndef FWPRIDEB_H
  29. #include "FWPriDeb.h"
  30. #endif
  31.  
  32. #ifndef FWSTRTOO_H
  33. #include "FWStrToo.h"
  34. #endif
  35.  
  36. //========================================================================================
  37. //    CLASS FW_TBoundedString
  38. //========================================================================================
  39.  
  40. //----------------------------------------------------------------------------------------
  41. //    FW_TBoundedString<tCapacity>::~FW_TBoundedString
  42. //----------------------------------------------------------------------------------------
  43.  
  44. template <unsigned short tCapacity>
  45. FW_TBoundedString<tCapacity>::~FW_TBoundedString()
  46. {
  47. }
  48.  
  49. //----------------------------------------------------------------------------------------
  50. //    FW_TBoundedString<tCapacity>::FW_TBoundedString
  51. //----------------------------------------------------------------------------------------
  52.  
  53. template <unsigned short tCapacity>
  54. FW_TBoundedString<tCapacity>::FW_TBoundedString() :
  55.     FW_CString()
  56. {
  57.     fRepresentation = fStorage;
  58.     fCapacity = tCapacity*FW_kMedianCharacterSize;
  59.     SetLength(0, 0);
  60. }
  61.  
  62. //----------------------------------------------------------------------------------------
  63. //    FW_TBoundedString<tCapacity>::FW_TBoundedString
  64. //----------------------------------------------------------------------------------------
  65.  
  66. template <unsigned short tCapacity>
  67. FW_TBoundedString<tCapacity>::FW_TBoundedString(
  68.                 const FW_TBoundedString<tCapacity> &string) :
  69.     FW_CString()
  70. {
  71.     fRepresentation = fStorage;
  72.     fCapacity = tCapacity*FW_kMedianCharacterSize;
  73.     SetLength(0, 0);
  74.     Append(string);
  75. }
  76.  
  77. //----------------------------------------------------------------------------------------
  78. //    FW_TBoundedString<tCapacity>::FW_TBoundedString
  79. //----------------------------------------------------------------------------------------
  80.  
  81. template <unsigned short tCapacity>
  82. FW_TBoundedString<tCapacity>::FW_TBoundedString(
  83.                                     const FW_CString &string) :
  84.     FW_CString()
  85. {
  86.     fRepresentation = fStorage;
  87.     fCapacity = tCapacity*FW_kMedianCharacterSize;
  88.     SetLength(0, 0);
  89.     Append(string);
  90. }
  91.  
  92. //----------------------------------------------------------------------------------------
  93. //    FW_TBoundedString<tCapacity>::FW_TBoundedString
  94. //----------------------------------------------------------------------------------------
  95.  
  96. template <unsigned short tCapacity>
  97. FW_TBoundedString<tCapacity>::FW_TBoundedString(const FW_Char *items, 
  98.                                     FW_CharacterCount numberItems) :
  99.     FW_CString()
  100. {
  101.     fRepresentation = fStorage;
  102.     fCapacity = tCapacity*FW_kMedianCharacterSize;
  103.     SetLength(0, 0);
  104.     Append(items, numberItems);
  105. }
  106.  
  107. //----------------------------------------------------------------------------------------
  108. //    FW_TBoundedString<tCapacity>::FW_TBoundedString
  109. //----------------------------------------------------------------------------------------
  110.  
  111. template <unsigned short tCapacity>
  112. FW_TBoundedString<tCapacity>::FW_TBoundedString(const FW_Char *items) :
  113.     FW_CString()
  114. {
  115.     fRepresentation = fStorage;
  116.     fCapacity = tCapacity*FW_kMedianCharacterSize;
  117.     SetLength(0, 0);
  118.     Append(items, FW_StringLength(items));
  119. }
  120.  
  121. //----------------------------------------------------------------------------------------
  122. //    FW_TBoundedString<tCapacity>::GrowCapacity
  123. //----------------------------------------------------------------------------------------
  124.  
  125. template <unsigned short tCapacity>
  126. FW_ByteCount FW_TBoundedString<tCapacity>::GrowCapacity(FW_ByteCount capacityNeeded)
  127. {
  128.     return tCapacity*FW_kMedianCharacterSize;
  129. }
  130.